package com.qf.controller;

import com.qf.entity.User;
import com.qf.service.UserService;

import com.qf.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api")
public class LoginUserController {
    @Autowired
    private UserService userService;
    @PostMapping("/login")
     public R login(@RequestBody User  user){
          User user1 = userService.login(user);
          if(user1!=null){
              return R.ok(user1);
          }else{
              return R.fail("用户名或密码错误");
          }
     }

}
